﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pay.Data.Mapping {
    public partial class ArticleMap
       : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<Article> {
        public ArticleMap() {
            ToTable("mc_Article", "dbo");

            HasKey(t => t.Id);
            Property(t => t.Id)
                .HasColumnName("Id")
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.MerchantId)
             .HasColumnName("MerchantId")
             .IsOptional();
            //Relationships
            HasOptional(t => t.Merchant)
              .WithMany()
              .HasForeignKey(d => d.MerchantId)
              .WillCascadeOnDelete(false);
        }
    }
}
